package 
{
	import qnx.ui.data.DataProvider;
	import qnx.ui.events.ListEvent;
	import qnx.ui.listClasses.List;
	import qnx.ui.listClasses.ListSelectionMode;
	import qnx.ui.listClasses.ScrollDirection;
	import qnx.ui.listClasses.ScrollPane;
	public class ChannelList extends BaseView
	{
		private var _chList:List;
		private var _chArray:Array;
		public function ChannelList()
		{
			super();
			_chArray = [];
			
			for(var i=0;i<100;i++){
				var obj:Object = new Object();
				obj.name = "#channelName" + i;
				obj.num = String(i);
				obj.topic = "I love this topic in this room.";
				_chArray.push(obj);
			}
			configUI();
		}
		
		private function configUI():void
		{
			
			_chList = new List();            
			//chList.setPosition(0, 100);            
			_chList.width = 1022;
			_chList.height = 460;
			_chList.columnWidth = 1020;
			_chList.setSkin(ChannelListRenderer);
			
			//set the dataProvider
			_chList.allowDeselect = false;
			_chList.selectionMode = ListSelectionMode.SINGLE;
			_chList.scrollDirection = ScrollDirection.VERTICAL;
			_chList.dataProvider = new DataProvider(_chArray);
			_chList.addEventListener(ListEvent.ITEM_CLICKED, onListClick);
			addChild(_chList);
		}
		
		private function onListClick(event:ListEvent):void
		{
			// TODO
		}
		
		public function setChannelArray(chArray:Array):void
		{
			this._chList.dataProvider = new DataProvider(chArray);
		}
	}
}